package com.neomanager.admin.dao;

import java.util.ArrayList;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class BbsDao extends SqlMapClientDaoSupport
{
	public Logger logger = Logger.getLogger(this.getClass());
	
	/**
	 *  게시판 목록
	 */
	public ArrayList<Map<String, Object>> selectBbsInfo(Map<String, Object> param) throws DataAccessException
	{
		logger.info("게시판 정보 목록 DAO");
		@SuppressWarnings("unchecked")
		ArrayList<Map<String, Object>> mlist = (ArrayList<Map<String, Object>>) getSqlMapClientTemplate().queryForList("bbs.selectBbsInfo", param);
		return mlist;
	}
	
	/**
	 * 게시판 상세
	 */
	public Map<String, Object> selectBbsInfoById(Map<String, Object> param) throws DataAccessException
	{
		logger.info("게시판상세 DAO");
		@SuppressWarnings("unchecked")
		Map<String, Object> rs = (Map<String, Object>) getSqlMapClientTemplate().queryForObject("bbs.selectBbsInfoById", param);
        return rs;
	}
	
	/**
	 *  게시판 등록
	 */
	public void insertBbsInfo(Map<String, Object> param) throws DataAccessException
	{
		logger.info("게시판 정보 등록 DAO");
		getSqlMapClientTemplate().insert("bbs.insertBbsInfo", param);
		return;
	}
	
	/**
	 * 게시판 수정
	 */	
	public void updateBbsInfo(Map<String, Object> param) throws DataAccessException {
		logger.info("게시판 수정 DAO");
		getSqlMapClientTemplate().update("bbs.updateBbsInfo", param);
        return;
	}

	/**
	 * 게시판 삭제
	 */	
	public void deleteBbsInfo(Map<String, Object> param) throws DataAccessException {
		logger.info("게시판 삭제 DAO");
		getSqlMapClientTemplate().update("bbs.deleteBbsInfo", param);
        return;
	}	
}


